<template lang="html">
  <div class="box">
      <div class="header">
          <el-form class="filterCondition demo-form-inline" :inline="true" label-width="80px">
              <el-input placeholder="输入车主姓名/联系方式" v-model="keyword" style="width: 420px;">
                <el-button slot="append" style="width: 120px;" @click="search()">搜索</el-button>
              </el-input>
          </el-form>
      </div>

      <div class="body">
          <el-table :data="tableData.list" style="width: 100%">
              <el-table-column label="车主姓名" prop="name" align="center" width=""></el-table-column>
              <el-table-column label="联系方式" prop="phone" align="center" width=""></el-table-column>
              <el-table-column label="已查询车牌号" align="center" width="">
                  <template slot-scope="scope">
                      <el-popover trigger="hover" placement="top">
                        <p>车牌号：{{scope.row.plateNumber}}</p>
                        <p>查询时间：{{scope.row.create_time}}</p>
                        <el-button type="primary" slot="reference" plain size="mini">查看详情</el-button>
                      </el-popover>
                  </template>
              </el-table-column>
              <el-table-column label="已查询次数" prop="num" align="center" width=""></el-table-column>
          </el-table>
      </div>

      <div class="page_box">
          <el-pagination class="page" layout="prev, pager, next"
            @current-change="switchPage" :current-page="currentPage" :page-count='tableData.rows' >
          </el-pagination>
      </div>

  </div>
</template>

<script>
export default {
  data(){
    return {
      keyword:'',
      tableData:[],
      currentPage:1
    }
  },
  created(){
    this.bbyTraffic()
  },
  methods:{
    search(){
      this.bbyTraffic()
    },
    bbyTraffic(page=1){
      this.currentPage = page;
      this.$http4.bbyTraffic({
        key: this.keyword,
        page:page
      }).then(res=>{
        this.tableData =
        res.data.code == 1?
        res.data.data :[]
      })
    },

    switchPage(p){
      this.bbyTraffic(p)
    }
  }
}
</script>

<style lang="css" scoped>
@import "../../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
/deep/ .table_box .preview-img{
  display:block;
  width: 100%;
  height: 30px;
}
.page_box{
  text-align: center;
}
</style>
